﻿/*=================================================================
* 版权信息：Copyright (C) 2005-2011 捷点科技 All Rights Reserved.
* 文件名称：CNVP_Review.cs
* 创建标识：曾乃强 15158756652 2011-03-18 01:03:05
* 修改标识：
* 功能描述：
===================================================================*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using CNVP.Framework.Helper;

namespace CNVP.JShop.BLL 
{
    /// <summary>
    /// 对*CNVP_Review*操作(针对业务层)的实现
    /// </summary>
    public class CNVP_Review
    {
        DAL.CNVP_Review dal = new DAL.CNVP_Review();
        
        #region BLL
        #region 添加
        /// <summary>
        /// 添加
        /// </summary>
        public int Add_CNVP_Review(Model.CNVP_Review obj)
        {
            return dal.Insert(obj);
        }
        #endregion
        
        #region 修改
        /// <summary>
        /// 修改
        /// </summary>
        public int Update_CNVP_Review(Model.CNVP_Review obj)
        {
            return dal.Update(obj);
        }
        public int ChangeReviewStatTrueBySet(string field, string rId)
        {
            return dal.ChangeReviewStatTrueBySet(field, rId);
        }
        public int ChangeReviewStatFalseBySet(string field, string rId)
        {
            return dal.ChangeReviewStatFalseBySet(field, rId);
        }
        public int ChangeReviewStatTrue(string field, int rId)
        {
            return dal.ChangeReviewStatTrue(field, rId);
        }
        public int ChangeReviewStatFalse(string field, int rId)
        {
            return dal.ChangeReviewStatFalse(field, rId);
        }
        public int Reply_CNVP_Review(Model.CNVP_Review obj)
        {
            return dal.Reply_CNVP_Review(obj);
        }        
         /// <summary>
        /// 修改，生成列的主键列构成的参数列表
        /// </summary>
        public int Update_CNVP_Review(int ID,string  UserID,string ReviewTitle,string ReviewContent,int ProductID,string LastReplyAuthor,DateTime LastReplyTime,byte IsShow,byte IsTop,byte IsDelete,DateTime AddTime)
        {
            return this.Update_CNVP_Review(new Model.CNVP_Review() {
            
                            ID=ID,
							UserID=UserID,
							ReviewTitle=ReviewTitle,
							ReviewContent=ReviewContent,
							ProductID=ProductID,
							LastReplyAuthor=LastReplyAuthor,
							LastReplyTime=LastReplyTime,
							IsShow=IsShow,
							IsTop=IsTop,
							IsDelete=IsDelete,
							AddTime=AddTime
            });
        }
        #endregion
        
        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        public int Delete_CNVP_Review(Model.CNVP_Review obj)
        {
            return dal.Delete(obj);
        }
        public int DeleteReviewBySet(string rId)
        {
            return dal.DeleteReviewBySet(rId);
        }
        public int CleanUpDeletedReview()
        {
            return dal.CleanUpDeletedReview();
        }
        public int AddToRecycle(int rId)
        {
            return dal.AddToRecycle(rId);
        }        
        /// <summary>
        /// 删除,生成列的主键列构成的参数列表
        /// </summary>
        public int Delete_CNVP_Review(int ID)
        {
            return this.Delete_CNVP_Review(new Model.CNVP_Review() {
            
                 ID=ID
            });
        }
        #endregion 
        
        public int GetCountOfReview(int id)
        {
            return dal.GetCountOfReview(id);
        }

        /// <summary>
        /// 查看单个
        /// </summary>
        public Model.CNVP_Review GetSingle_CNVP_ReviewById(int ID)
        {
            return dal.LoadById(ID);
        }

        /// <summary>
        /// 查看全部,产品ID
        /// </summary>
        public List<Model.CNVP_Review> GetAll_CNVP_Review(int ProductID)
        {
            return dal.LoadAll(ProductID);
        }

        /// <summary>
        /// 查看全部,产品ID,评分数
        /// </summary>
        public List<Model.CNVP_Review> GetAll_CNVP_Review(int ProductID, string rateStatus)
        {
            return dal.LoadAll(ProductID, rateStatus);
        }
        #endregion
        public DataTable GetReviewPage(string PageName, int PageIndex, int PageSize, int ProductId, out int RecordCount, out int PageCount, params SQLConditionInfo[] SqlCondition)
        {
            return dal.GetReviewPage(PageName, PageIndex, PageSize,ProductId, out RecordCount, out PageCount, SqlCondition);
        }

        public DataTable GetUserReviewPage(string PageName, int PageIndex, int PageSize, out int RecordCount, out int PageCount, string userID)
        {
            return dal.GetUserReviewPage(PageName, PageIndex, PageSize, out RecordCount, out PageCount, userID);
        }

        public DataTable GetReviewAll(string PageName, int PageIndex, int PageSize, out int RecordCount, out int PageCount)
        {
            return dal.GetReviewAll(PageName, PageIndex, PageSize, out RecordCount, out PageCount);
        }
        public DataTable GetReviewForRecycleAll(string PageName, int PageIndex, int PageSize, out int RecordCount, out int PageCount)
        {
            return dal.GetReviewForRecycleAll(PageName, PageIndex, PageSize, out RecordCount, out PageCount);
        }

        /// <summary>
        /// 获取评论评分，1分到5分。设置好评'4,5' 中评'3,2' 差评'1'
        /// </summary>
        /// <param name="PageName"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="RecordCount"></param>
        /// <param name="PageCount"></param>
        /// <param name="rateStatus">可传人'1,2,3,4,5'</param>
        /// <returns></returns>
        public DataTable GetRateStatusReviewPage(string PageName, int PageIndex, int PageSize, int ProductId, out int RecordCount, out int PageCount, string rateStatus)
        {
            return dal.GetRateStatusReviewPage(PageName, PageIndex, PageSize, ProductId, out RecordCount, out PageCount, rateStatus);
        }
    }
}

